package com.tools.web.interceptor.auth;

import com.tools.common.container.OwnPairs;
import com.tools.common.object.C;
import com.tools.common.object.Note;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 保持用户认证信息的对象的接口
 * */
@Note("保持用户认证信息的对象的接口")
public interface AuthUser {

    @Note("克隆一个新的 AuthUser 认证对象。" +
            "newUser 是用户数据对象")
    AuthUser cloneAuthUser();

    Object getUserId();

    <ID> ID getUserId(Class<ID> idType);

    <ID> ID getUserId(C<ID> idType);

    void setUserId(Object userId);

    Object getUser();

    <U> U getUser(Class<U> userClass);

    <U> U getUser(C<U> userType);
    
    void setUser(Object user);

    Class<?> getUserTypeClass();

    void setUserTypeClass(String userTypeClassName);

    Map<String, ?> getRoleKeyMap();

    <V> Map<String, V> getRoleKeyMap(Class<V> valueType);

    Set<String> roleKeySet();

    Collection<?> roleValueCollection();

    <V> Collection<V> roleValueCollection(Class<V> valueType);

    <V> Collection<V> roleValueCollection(C<V> valueType);

    Map<String, ?> cloneRoleKeyMap();

    <V> Map<String, V> cloneRoleKeyMap(Class<V> valueType);

    <V> Map<String, V> cloneRoleKeyMap(C<V> valueType);

    void setRoleKeyMap(Map roleKeyMap);

    Map<String, ?> getPermissionKeyMap();

    <V> Map<String, V> getPermissionKeyMap(Class<V> valueType);

    Set<String> permKeySet();

    Collection<?> permValueCollection();

    <V> Collection<V> permValueCollection(Class<V> valueType);

    <V> Collection<V> permValueCollection(C<V> valueType);

    Map<String, ?> clonePermissionKeyMap();

    <V> Map<String, V> clonePermissionKeyMap(Class<V> valueType);

    <V> Map<String, V> clonePermissionKeyMap(C<V> valueType);

    void setPermissionKeyMap(Map permKeyMap);

    List<?> getRouterList();

    <V> List<V> getRouterList(Class<V> routerType);

    List<?> cloneRouterList();

    <V> List<V> cloneRouterList(Class<V> routerType);

    <V> List<V> cloneRouterList(C<V> routerType);

    void setRouterList(Iterable routerList);

    Map<String, Object> cloneCustomData();

    String getUuid();

    void setUuid(String uuid);

    String getDeviceTypeId();

    void setDeviceTypeId(String deviceTypeId);

    String getUserType();

    void setUserType(String userType);

    AuthUser uuid(String uuid);

    AuthUser deviceTypeId(String deviceTypeId);

    AuthUser userType(String userType);

    AuthUser userId(Object userId);

    AuthUser user(Object user);

    AuthUser userTypeClass(String userTypeClassName);

    AuthUser roleKeyMap(Map roleKeyMap);

    AuthUser permissionKeyMap(Map permissionKeyMap);

    AuthUser routerList(Iterable routerList);

    AuthUser putData(String name, Object value);

    AuthUser putAllData(Map customData);

    AuthUser putAllData(OwnPairs customData);

    AuthUser putAllData(Object javaBean);

    AuthUser putAllData(String jsonObject);

    AuthUser removeData(String name);

    AuthUser removeAllData(String... names);

    AuthUser removeAllData(Iterable<String> names);

    AuthUser clearData();

    boolean containsData(String name);

    boolean containsAllData(String... names);

    boolean containsAllData(Iterable<String> names);

    boolean containsAnyData(String... names);

    boolean containsAnyData(Iterable<String> names);

    int dataSize();

    Object dataGet(String name);

    <V> V dataGet(String name, Class<V> valueType);

    <V> V dataGet(String name, C<V> valueType);
}
